#include "app_modbus.h"

int main(int argc, char const *argv[])
{
    int ret =  app_modbus_init("/tmp/ttyV0");

    if(ret==-1)
    {
        return -1;
    }
    int slave_device_id = 1;
    int start_address = 2;
    uint8_t motor_status=1;

   app_modbus_writeCoil(slave_device_id,start_address,1,&motor_status);

   uint16_t motor_speed = 100;
   app_modbus_writeHoldingRegister(slave_device_id,start_address,1,&motor_speed);


   uint8_t motor_cur_status=0;
   app_modbus_readCoil(slave_device_id,start_address,1,&motor_cur_status);

   printf("motor_cur_status:%d\n",motor_cur_status);


   uint16_t motor_cur_speed = 0;
   app_modbus_readInputRegister(slave_device_id,start_address,1,&motor_cur_speed);
   printf("motor_cur_speed:%d\n",motor_cur_speed);



    return 0;
}
